const charset = require('superagent-charset');
const superagent =  charset(require('superagent'));
require('superagent-proxy')(superagent);
const tencentcloud = require('tencentcloud-sdk-nodejs');
const { smsDebug, smsNotify, wxpusher } = require('./ti_config');
const fs = require('fs');
const { Console } = require('console');
const crypto = require('crypto');
const http = require("http");  // 引入内置http模块
const urlparse  = require("url");

//const got = require('got');

const HttpsProxyAgent = require("https-proxy-agent");

const {
    get,
    set,
    expire,
    randBetween,
} = require('../util');

const sdate = require('silly-datetime');



//console信息输出到文件
const consoleLogger = new Console({
	stdout: fs.createWriteStream('./stdout.log', {
		flags:'a+'
	}),
	stderr: fs.createWriteStream('./stderr.log', {
		flags:'a+'
	}),
});

const sleep = ms => {
	return new Promise(resolve => setTimeout(resolve, ms));
}
const logger = function() {
	console.log('[', (new Date()).Format("yyyy-MM-dd hh:mm:ss"), ']', ...arguments);
	consoleLogger.log('[', (new Date()).Format("yyyy-MM-dd hh:mm:ss"), ']', ...arguments);
	return null;
}

exports.SendSms = (params, type = 'notify') => {
	params.SignName = '本我科技';
	params.SmsSdkAppId = '1400588139';

	if (type == 'notify') {
		params.PhoneNumberSet = smsNotify;
	} else {
		params.PhoneNumberSet = smsDebug;
	}

	const clientConfig = {
		// 腾讯云认证信息
		credential: {
		  secretId: "AKIDELH1Zwv6vZ0GKCu0iGf1FJF2fMJ6rkLk",
		  secretKey: "NabWHyZyBC4kHKH488wYyCE4i9OSL4b2",
		},
		// 产品地域
		region: "ap-guangzhou",
		// 可选配置实例
		profile: {
		  signMethod: "HmacSHA256", // 签名方法
		  httpProfile: {
			reqMethod: "POST", // 请求方法
			reqTimeout: 30, // 请求超时时间，默认60s
		  },
		},
	};
	const client = new tencentcloud.sms.v20210111.Client(clientConfig);
	client.SendSms(params);
}

exports.getHiddenFieldNum = (html, field) => {
	const tmp = html.split(field)[1].split('>')[0].match(/value="(\d+)"/);
	return tmp[1] ? Number(tmp[1]) : 0;
}

//监测是否遇到了google监测机器人拦截。如果是，则停等2分钟
exports.checkCaptcha = async page => {
	const check = await page.$('.sec-container');
	if (check) {
		logger('检测到google验证拦截');
		await sleep(60000);
	}
}

exports.saveScreenshot = async (page, prefix) => {
	const filename = `${(new Date()).Format("yyyyMMdd_hhmmss")}_${prefix}.jpg`;
	await page.screenshot({
		path: './screenshot/' + filename,
		fullPage: true,
	});
}

exports.getProxy = () => {
	return new Promise((resolve, reject) => {
		const proxySvr = 'http://tiqu.linksocket.com:81/abroad?num=1&type=1&lb=1&sb=0&flow=1&regions=us1&port=1';
		superagent.get(proxySvr).timeout(10000)
			.set('user-agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36')
			.end((err, res) => {
				if (err) {
					return reject(err);
				}
				const proxy = 'http://'+res.text;
				resolve(proxy);
			});
	});
}

const tiGet = (url, contentType, cookie, referer) => {
	return new Promise((resolve, reject) => {
		superagent.get(url).timeout(8000)
			.set('authority', 'www.ti.com.cn')
			.set('pragma', 'no-cache')
			.set('cache-control', 'no-cache')
			.set('sec-ch-ua', ' Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"')
			.set('sec-ch-ua-mobile', '?0')
			.set('sec-ch-ua-platform', '"macOS"')
			.set('upgrade-insecure-requests', '1')
			.set('user-agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36')
			.set('Content-Type', contentType)
			.set('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9')
            .set('sec-fetch-site', 'none')
			.set('sec-fetch-mode', 'navigate')
			.set('sec-fetch-user', '?1')
			.set('sec-fetch-dest', 'document')
			.set('accept-language', 'zh-CN,zh;q=0.9')
			.set('cookie', '_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo="CN"; user_pref_currency="CNY"; _fbp=fb.2.1636048547960.508365719; user_pref_language="zh-CN"; alias=sys-null-null-cninfra_uhv-bhp-pp-null-cn; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.55%20Safari%2f537.36; ti_bm=; user_pref_givenNameLocalLanguage="%E6%B3%BD%E8%B1%AA"; login-check=null; acceleratorSecureGUID=d3d76ad574e466b91f18133422294ab1960a7a1d; auth_session=qmnMdQs4DDBskN_4.y02UFVAQoheHYU6rMoV4nZXL38FnhWNyo636h8iqO8DbRNYuR4U3G7QA4HpM_Kh-NVgn5cHTudk0t1vhqer-BqkoqOtLiUMU_A50Jsa2N05dIeerIN0UQ7udhWPAxvjVIY0Ji7WLrud1JuYqMGlu1nZ_lWEipNxo3cAE_v8Ar9FkpSDpl4UACltUQkJY4QowWllHzsWiKMnsiIK7IEtTbZacbcuvqYjDfOTs76l1smvd52fe-DzM1jJvYbkgRFvEw_zPtXrfgWLapR9WDkpjmjWcWroquWWha3u_VlFa91KzoWpDrxaistegG4E1gJ5KFmqJdRPA6CwKGWhRCdMrGUPIl4V6Curd5YiQjO0juRofGKkdU3qQYXGfxHk0np4p6A_nq5UuOBqzL2u3LJwdgdhS7m5jzDoqw6AIkBJulbrmvw30gSkPT-QDuAdRaA_AL-jUmavit9WqKVdl59aFvLV7NRCChNekyUdcYkxqLgo7Q-otA5H0hleOUBv5njZL7vxmw2I9TDNUKYQ864uBtyoEO1g-16wBKonQ7ftN9dh0DMIme9YuVSbH5pBO9cxe0wmkoFSKHbMMcJd7IFFDhXSpf-8oMZsVE7jKuSQSbpr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HluK6jxU420Q.JDqYuJmklaPm0akAFTjv5A; _gid=GA1.3.1282257837.1638296294; user_pref_givenName="Xiaoying"; login-check=null; bm_sz=73E0FE81A2C50B6265E3EA2B797DB047~YAAQLQrgemkIx0F9AQAAN/BBfg08WbzPEE8d/Bq0+Dj915EOa6nUibLxsE2toOdCwt/HY4EMBDlZ0wfh1Ci1N18L4le0lsiccKQZkuvw/bSJ+GfY3xYX6V/unZpG1LooP627itBD6iQ5d6vNHwxQ9UCul4TLMtA5HsTVEIaSJX3o43hp3I0wcp2f9v9lNEOHNe9OBiZDvRLisoUECdD3DQhXVskTUyXtpAzYW2mlohNUFDOBv0fATlmy9rakQMjukryWc6oNS1G6dpw/IJmifN4xytNzqjiCOEj6kOvddzDmCJKDESI+8RnKi7XCsLctfulO1PC2iwZXjQ/7UP1uWVSdBURQ7lJ62c5iLtbOGHKd0FX559a+P4GdtLPiSzMLUpG6djaDfaKACE8lOEVJhRfa8w==~3158582~3486018; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20211108%3A22%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20211108%3A22%7CG3YHLXUICZC3XKDXYVVLO4%3A20211108%3A22; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; user_pref_permanentId="6887527"; user_pref_uid="maze@thunderchip.com"; last-domain=www.ti.com.cn; tipage=%2Ftistore%2Fproduct%20page%20PINA350ABSIDDFR%20zh; tipageshort=product%20page%20PINA350ABSIDDFR%20zh; ticontent=%2Ftistore; auth_state_BXkqLzjsFI3KG-5CAnVFw8jJcv0=c4BFVRHcFfxbsyEW.yniENl4LbbQaZjeseNUlrUMUSLC9OP_DUcih4Ja5BSNkZ2KiPiYvd-bt7YIDIGZrJY7go9ik7DevNljoH4JeLFet4eZbZn6RU6UPHefzm0Jp8JfW46y1tyYJHSmZAMOuLKS31uvYrfoxKvdbt9PHYrBqhLo3vgPbJCdzQuRowbfMiWJYMeCz0EhSUdyiulFTJmAqUYppYOPbNZH4J8-pp7EX7j0j13XvaPRCmVn18fAD43tY697yELqkSjm23dIqrzdTYoljyZ9cBjMpV5PpiMMf-5FW_KKa36tamkr3SQUY2bQCXU9K148pp-Ko-53W_Qjp3SSFuOxKNTElbOorNkGDudegq0PsaFIACRZ8bAuEF45fiu36H6RgRNbOVhP8bOXxJWYjXTebTc7ioYLyqXN6eAOwYMzAHl8U7Ry8b0kEogdmN2qg2YCNR4lDCVHNtRhyYOkNZSKTpWpP6TA4H7GT.TVk7NgLiR5wVCmERH91zoQ; _abck=C446E9D5801784995040171CCA462AB3~-1~YAAQHwrgeo8+OUd9AQAA7I9HfgZOM2MihuiMhEpROg/gNl1uoKcJQdZZkMl7E83n0rrAOELfxrKl0sUhT373m6nOmnmIIU+5qvYCI0YsAED5kAX7hpLhL1J13MvNb+u0HfiL2IEZ9otkK1z7s1sM+oxf5pfmfh+Cjycf+OdnqIO3YpWkiiizC+nfF2RHETnHmNYCPtMCm+OBssSFiZQNeZV1mAIz+CLneTOwGbFrxERBGTIOd7tI1iSIdW1fWWp59QgI760qRBzPetEDHKk70B7nMwi1E3lloG/DUhlDa3Ffyw3nPq3xtyyJ24MNiMogU4+PcZFy7kjkGXK3lcgPzZxwX3gbVsEygP9AOX70NVVTjv8qQNl9KAKFJJrf9N4zylwedw27+m63Bk03vqfhKWjbh/YFMNvxhAjCqKlxrY60XDcsGSdz/OueW4LsEt5tCnnOJGJcOfD/thovhxI8uiNieg==~-1~-1~-1; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1638448362984&cst=1638500797125&ns=63&pvt=509&pvis=5&th=686831.851794.292.20.20.1.1626858218035.1638200937504.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:75$_ss:0$_st:1638502947743$free_trial:false$dc_visit:66$channel:organic%3Bexp-1638640546376$ctimestamp:Fri%20Nov%2005%202021%2001%3A55%3A46%20GMT%2B0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)%3Bexp-1638640546376$_pn:5%3Bexp-session$ses_id:1638500796137%3Bexp-session$dc_event:4%3Bexp-session$dc_region:ap-east-1%3Bexp-session; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; ak_bmsc=25AE9E9B5AAE6DE71ACF8EF0F672183E~000000000000000000000000000000~YAAQ5IvytmOf8yd9AQAAFSXmfg0ipxvJO9MKfULm9ZV7N7rpLGo31cZ2LBjRQG+pz/Izg/bWfm2eWCjRcX6qMFmxw+tg4N3GEP0qH//eJk8bEphiHz87rmnwrK9uNRQ1kKTrUEj0rSXJupADCtq2M55esrTG18oAXV/jmXqQINgtcM+DeQI+am2n4oayPMTRXUdU3i1iy/iOAiF3KWsCqPqmzcOMK9GaYFEI1uxDOYzDr61yq1z1YTzOAwrYvMge3XecdFNem1x69CXUmOKteMAppWx1b0ApUjDdisg/ThF3ErekqNnDRiMX1fBbk+Vwgt/ST2kk19CV4QvssY75a2rvkdvZCg2/IKz8vfAh34FEJ2AcAdaTd58TfdiXKUrIwtw34g3irK8=; bm_sv=D4B3E0A76B30922CC5162078EB582374~5lMrVqCs8L1aeR0fDZC1gEftmPhAaTyaIE554l5G2IHOcKZBJ4P9NkWUXaBxsd7d4FQZW+pIzze4mZLovvncxNoe0zmzbDlKxJYDh8rG4wDgF8cz6iSZ876HxMKevYA9H8pE2RzcmmPEekhtCIqYrH+3wI7+jzbffOmbYmuQkXM=; ti_rid=33a59789')
			.end((err, res) => {
				logger('res2', res);
				logger('err', err);
				if (err) {
					return reject(err);
				}
				resolve(res.text);
			});
	});
}
exports.tiGet = tiGet;


async function getIp(num){    
    logger(2234);
    //const result = await httpPost('http://webapi.http.zhimacangku.com/getip?num=1&type=2&pro=&city=0&yys=0&port=2&pack=193720&ts=0&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=');
    //const result = await httpPost('http://ecs.hailiangip.com:8422/api/getIp?type=2&num=1&pid=-1&unbindTime=600&cid=-1&orderId=O21111814053891278876&time=1637215756&sign=a0073f9d5076c00af21f8824e238ecdc&noDuplicate=0&dataType=0&lineSeparator=0&singleIp=');
	let result = '';
	try{
    	 //result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=0&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=1&pro=&city=0&yys=0&port=11&pack=195828&ts=1&ys=0&cs=1&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 
	}catch(e){
		logger(e);
		//easyPushWechatMsg('ip代理出了问题');
	}
	
	if(result == ''){
		return false;
	}
    //logger(result);
    let ip_info = JSON.parse(result);

    if(ip_info['code']!=0){
        return false;
    }

    let ip_arr = [];
    for(var i=0;i<ip_info['data'].length;i++){
    	let tmp_ip = 'http://'+ip_info['data'][i]['ip']+':'+ip_info['data'][i]['port'];
    	let expire_time = new Date(ip_info['data'][i]['expire_time']).getTime();
    	let tmp_arr = {'ip':tmp_ip, 'expire_time':expire_time/1000, 'serial':''};
    	ip_arr.push(tmp_arr);
    }

    let today = sdate.format(new Date(), 'YYYY-MM-DD');

    let key = 'ip_num_'+today;

    let ip_num = await get(key);

    logger('ip_num123123', ip_num);

    if(!ip_num){
    	ip_num = 0;
    }
    ip_num = Number(ip_num) + ip_arr.length;

    await set(key, ip_num);

    logger('ip_num', ip_num);
    
    return ip_arr;
}
exports.getIp = getIp;



async function getIp_v2(num){    
    logger(2234);
	let result = '';
	try{
    	 //result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=0&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=100017&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=45&mr=1&regions=&username=chukou01&spec=1');
    	 
	}catch(e){
		logger(e);
		//easyPushWechatMsg('ip代理出了问题');
	}
	
	if(result == ''){
		return false;
	}
    //logger(result);
    let ip_info = JSON.parse(result);

    if(ip_info['code']!=0){
        return false;
    }

    let ip_arr = [];
    for(var i=0;i<ip_info['data'].length;i++){
    	let tmp_ip = 'http://'+ip_info['data'][i]['ip']+':'+ip_info['data'][i]['port'];
    	let expire_time = new Date(ip_info['data'][i]['expire_time']).getTime();
    	let now_time = new Date().getTime();
    	if( (expire_time - now_time)/1000 >60*20 ){
    		ip_arr.push(tmp_ip);
    	}
    }

    // let today = sdate.format(new Date(), 'YYYY-MM-DD');

    // let key = 'ip_num_'+today;

    // let ip_num = await get(key);

    // logger('ip_num123123', ip_num);

    // if(!ip_num){
    // 	ip_num = 0;
    // }
    // ip_num = Number(ip_num) + ip_arr.length;

    // await set(key, ip_num);

    // logger('ip_num', ip_num);
    
    return ip_arr;
}
exports.getIp_v2 = getIp_v2;

async function getIp_v3(num){    
    logger(2234);
	let result = '';
	try{
		 let rawStr = 'num='+num+'&pt=1&result_type=json&trade_no=1781030812674328&key=9d659cd1477041fca68ce46db3b04968';

		 let sign = crypto.createHash('md5').update(rawStr).digest("hex");

		 logger('sign', sign);

    	 //result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=0&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 result = await httpGet('https://v1.api.juliangip.com/dynamic/getips?num='+num+'&pt=1&result_type=json&trade_no=1781030812674328&sign='+sign);
    	 
	}catch(e){
		logger(e);
		//easyPushWechatMsg('ip代理出了问题');
	}
	
	if(result == ''){
		return false;
	}
    //logger(result);
    let ip_info = JSON.parse(result);

    logger('ip_info',ip_info);

    if(ip_info['code']!=200){
        return false;
    }

    let ip_arr = [];

    let proxy_list = ip_info['data']['proxy_list'];
    for(var i=0;i<proxy_list.length;i++){
    	let tmp_ip = 'http://'+proxy_list[i];
    	ip_arr.push(tmp_ip);
    }

    // let today = sdate.format(new Date(), 'YYYY-MM-DD');

    // let key = 'ip_num_'+today;

    // let ip_num = await get(key);

    // logger('ip_num123123', ip_num);

    // if(!ip_num){
    // 	ip_num = 0;
    // }
    // ip_num = Number(ip_num) + ip_arr.length;

    // await set(key, ip_num);

    // logger('ip_num', ip_num);
    
    return ip_arr;
}
exports.getIp_v3 = getIp_v3;


async function getIp_v4(num){    
    logger(2233334);
	let result = '';
	try{
    	 //result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=0&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 result = await httpGet('http://tiqu.pyhttp.taolop.com/getip?count='+num+'&neek=15825&type=2&yys=0&port=1&sb=&mr=1&sep=0&ts=1&pack=9444');
    	 
	}catch(e){
		logger(e);
		//easyPushWechatMsg('ip代理出了问题');
	}
	
	if(result == ''){
		return false;
	}
    //logger(result);
    let ip_info = JSON.parse(result);

    if(ip_info['code']!=0){
        return false;
    }

    let ip_arr = [];
    for(var i=0;i<ip_info['data'].length;i++){
    	let tmp_ip = 'http://'+ip_info['data'][i]['ip']+':'+ip_info['data'][i]['port'];
    	let expire_time = new Date(ip_info['data'][i]['expire_time']).getTime();
    	let now_time = new Date().getTime();
    	if( (expire_time - now_time)/1000 >60*20 ){
    		ip_arr.push(tmp_ip);
    	}
    }
    
    return ip_arr;
}
exports.getIp_v4 = getIp_v4;

async function getIp_v5(num){    
    logger(2234);
    //const result = await httpPost('http://webapi.http.zhimacangku.com/getip?num=1&type=2&pro=&city=0&yys=0&port=2&pack=193720&ts=0&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=');
    //const result = await httpPost('http://ecs.hailiangip.com:8422/api/getIp?type=2&num=1&pid=-1&unbindTime=600&cid=-1&orderId=O21111814053891278876&time=1637215756&sign=a0073f9d5076c00af21f8824e238ecdc&noDuplicate=0&dataType=0&lineSeparator=0&singleIp=');
	let result = '';
	try{
    	 //result = await httpGet('http://webapi.http.zhimacangku.com/getip?num='+num+'&type=2&pro=&city=0&yys=0&port=1&pack=195828&ts=1&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&username=chukou01&spec=1');
    	 result = await httpGet('http://tiqu.pyhttp.taolop.com/getip?count='+num+'&neek=15825&type=2&yys=0&port=1&sb=&mr=2&sep=0&ts=1&pack=9444');
    	 //result = await httpGet('http://tiqu.pyhttp.taolop.com/getip?count='+num+'&neek=15825&type=2&yys=0&port=1&sb=&mr=2&sep=0&ts=1&time=2');
	}catch(e){
		logger(e);
		//easyPushWechatMsg('ip代理出了问题');
	}
	
	if(result == ''){
		return false;
	}
    //logger(result);
    let ip_info = JSON.parse(result);

    if(ip_info['code']!=0){
        return false;
    }

    let ip_arr = [];
    for(var i=0;i<ip_info['data'].length;i++){
    	let tmp_ip = 'http://'+ip_info['data'][i]['ip']+':'+ip_info['data'][i]['port'];
    	let expire_time = new Date(ip_info['data'][i]['expire_time']).getTime();
    	let tmp_arr = {'ip':tmp_ip, 'expire_time':expire_time/1000, 'serial':''};
    	ip_arr.push(tmp_arr);
    }

    logger('ip_arr', ip_arr);
    
    return ip_arr;
}
exports.getIp_v5 = getIp_v5;

async function getIp_v6(num){    
    logger(2234);
	let result = '';
	try{
    	 result = await httpGet('http://11550505.v4.dailiyun.com/query.txt?key=NPX022152H&word=&count='+num+'&rand=false&ltime=0&norepeat=false&detail=false');
    	 
	}catch(e){
		logger(e);
	}
	
	if(result == ''){
		return false;
	}

    let ip_arr = [];

    let list = result.split("\r\n");

    let proxyusernm = '11550505';

    let proxypasswd = '12345678';

    for(var i=0;i<list.length;i++){
    	if(list[i]){
    		let tmp_ip = 'http://'+proxyusernm+":"+proxypasswd+"@"+list[i];
    		let expire_time = new Date().getTime() + 300*1000;
    		let tmp_arr = {'ip':tmp_ip, 'expire_time':expire_time/1000, 'serial':''};
	    	ip_arr.push(tmp_arr);
    	}
    }

    logger('ip_arr', ip_arr);
    
    return ip_arr;
}
exports.getIp_v6 = getIp_v6;


const easyPushWechatMsg = async (msg) => {
    try {
        await httpPost('http://wxpusher.zjiecode.com/api/send/message', JSON.stringify({
            appToken: wxpusher.appToken,
            content: msg,
            contentType: 1,
            uids: wxpusher.uids,
        }), 'application/json');
    } catch(e) {
        logger(e);
    }
}
exports.easyPushWechatMsg = easyPushWechatMsg;

//使用代理来请求目标url
exports.httpProxyGet = (url, proxy) => {
	return new Promise((resolve, reject) => {
		superagent.get(url).timeout(13000).proxy(proxy)
			.set('user-agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36')
			.end((err, res) => {
				if (err) {
					return reject(err);
				}
				resolve(res.text);
			});
	});
}

exports.httpProxyGet2 = async (url, proxy) => {

	const agent = new HttpsProxyAgent(proxy);

	logger('url', url);

	let res = '';
	try{

		res = await got(url, {
		    agent: {
		      https: agent,
		      http: agent,
		    },
		    timeout: {
				timeout: {
					lookup: 100,
					connect: 50,
					secureConnect: 50,
					socket: 1000,
					send: 10000,
					response: 1000
				}
			}
		 }).json();
	}catch(e){
		logger('url2', url);
		logger(e);
	}	

	logger('url3', url);

	logger('res', res);

	return res;
}

const httpProxyGet6 = (url, proxy) => {
    return new Promise((resolve, reject) => {
    	superagent.agent().get('https://www.ti.com.cn').timeout(10000);
        superagent.agent().get(url).timeout(15000).proxy(proxy)
            .set('authority', 'www.ti.com.cn')
            .set('pragma', 'no-cache')
            .set('cache-control', 'no-cache')
            .set('sec-ch-ua', ' Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"')
            .set('sec-ch-ua-mobile', '?0')
            .set('sec-ch-ua-platform', '"macOS"')
            .set('upgrade-insecure-requests', '1')
            .set('user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36')
            .set('sec-ch-ua-mobile', '?0')
            .set('accept','text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9')
            .set('sec-fetch-site', 'none')
            .set('sec-fetch-mode', 'navigate')
            .set('sec-fetch-user', '?1')
            .set('sec-fetch-dest', 'document')
            .set('accept-language', 'zh-CN,zh;q=0.9')
            .set('cookie','_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo="CN"; user_pref_currency="CNY"; _fbp=fb.2.1636048547960.508365719; user_pref_language="zh-CN"; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.93%20Safari%2f537.36; login-check=null; ti_bm=; _gid=GA1.3.822752370.1639793430; login-check=null; acceleratorSecureGUID=c88e1840a309daa1adc53a3f2fc8a8d262a49f73; user_pref_permanentId="6930467"; user_pref_uid="zhangzz@szbntkj.com"; user_pref_givenNameLocalLanguage="li"; user_pref_givenName="lao"; alias=homepageproduct; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20220007%3A11%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20220007%3A11%7CG3YHLXUICZC3XKDXYVVLO4%3A20220007%3A11; ticontent=%2Fanalog%20and%20mixed-signal%2Famplifiers%2Finstrumentation%20amplifiers; tipage=%2Fanalog%20and%20mixed-signal%2Famplifiers%2Finstrumentation%20amplifiers%2Finstrumentation%20amplifiers%20products%20tab-cn; tipageshort=instrumentation%20amplifiers%20products%20tab-cn; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1639930285262&cst=1639932228554&ns=79&pvt=617&pvis=3&th=686831.851794.388.2.31.1.1626858218035.1639904710157.1_787294.978375.4.4.1.1.1639793849084.1639816463061.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:92$_ss:0$_st:1639934044801$free_trial:false$dc_visit:81$_pn:3%3Bexp-session$ses_id:1639932227510%3Bexp-session$dc_event:4%3Bexp-session$dc_region:ap-east-1%3Bexp-session; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; last-domain=www.ti.com; auth_session=nqcBsPermcULGnEC.7fssstWZXvD4C4E5liu51VYLJYrvi50on31c3r6Z9TtH9Yg29ixjBY8L8blF2_3vxBc8orCZNP5_ClZw77NDF39q25afZbFYmujdvoOdBEAJqp4-5LVK13NRR4z_kzKEakRGd1EO8xN4bbhdJmIptnfnvFmYBx8Z58pmZRMMfWAW7qRgU9h10CJZd9lMJ3R2jFsonvBai11BMK7NtM4ZlDya1pln0VnHhqxOzS38jiiHEiDf9e_W98o5iwJWovnLuTy-OWzNxo95h-vQoxN5um9v4Y4IxOTzGEKPJX3Vh9aZby-FZOWXEGTEcLG3WZvdbNnQgH5-q-QRK2jZE6RC_83gG3OLU-1LZyAHIFT0EI1Sh1K3RjXtlnf1g3P_wn20CiJOO--_C_fNTspiMMWu8aoRgkQwOsyBsgCqBxh1jtCH6B4VawYzHBgLO6iACPaJuV-6RgX5z3nK3OAJGSFggVSRvci-D1VFUOPXoETmAEHeiTppnAvHD0qyCsLSFvuasx4H3unPad7XZis9SyfAqklMS93IMLlRM5TcC1_ho0VLZi5l0UwKJHRZQwJbIdaLGR1ZOZ-i7bujbtJxkIrBNjiN7Kopft7Kf4H6wMeIfpEv5r3Bx7yUxDyIP-PiibhZPm_IcLRGVkmazZwc7wkM7TMIChC_-5qAF2RsxbDB8Sq7t2y9OmIji2uhysy3h7TSqBIZA6OS_rURm0a15RjR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Ib_qAMoLYShcWdWBHZOFyiImiM-GCNFkaox1e8nnUT2RHIfgMDxcJJOwZE73nZfjYu6MBlbC9N_mt-5dk5klbO-iZOkUjVpeXxjyoyD2H0-LMjx-W145LjAbXQtzMAoulD2sfjHl-bgEmCqdVwaytDmjm_etYCZEo9RYIZZMVmlXaoNCVVz3oAHx4PvBDX2rl951FH7SLOg2qtGqv5iK2VXve_ESW7WPHqpt4aYtjm2aMNlpo2BFAcAyL1RcCTYRUoh4l1vhcFykiKeq2HRAUOQKnJOhhujfpYB2hAsXQtlHZdwB-kQc.Gw0a4xTGQJ5RsmcVINC3vw; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.136.97; _abck=B136F03CD14C505579F485FCD043ABEA~-1~YAAQdkInO/zSV7x9AQAAwWu31QdgqweIPWiLXChNoDt2oIBpAO9ZT1PzQ/DK5LZKilRd9oeVV+I4ChEMa3GBxrJeKE52F9rbsgevK9TyEJyRzZkdx4FnkN8iKnsvlwrOsF0iujFCfHSLlH3u3Zr/l+vIy9Q4j2/uzb2sPUKETlRXbnjlL1rfLVC4zdPrfuWwcsh4LMkyBhmaVW0c4gyZil4LAMOAZRgFvWAePmbCS9ugAgxQ1LB9iLg+PKLhwa9p4nVU3ICMfVDDrNaOy6FaFCv3grpYm9MD9dGm0q5zp9dYxNoeOSHg3vkPrcCEVCseaXZ4pDRPpzMaJ3/fr3s4YMVfZWknqtbV7inbwpoyAVRRo5lntMI/gaif3x1aSI2dZFp23VbbcWq6lEsSrKpmx3+0vhJnLseXD+T7y+EK1ibxm7SdCm8rJaWOCAAr5kkxxN9yB+WzbK6ZIVCSXZw1xaiCvbfaCtHqATf9f8wSTK4=~-1~-1~-1; ak_bmsc=A95763CA6DF805715245231EA556C060~000000000000000000000000000000~YAAQdkInO/3SV7x9AQAAwWu31Q7KiLnuefXID4ZtEqj30jXoyJDxgHrCmp0bzO3dYvfzu1CBpe9lKo21Z6IZNvdiX3jVhqIhStWzDkeaLU+4ldN7n41sDOPrg0pUnepMhxIgg4tckS1rRxQfrV97aXHU0LCDTtKdSejYI+aLxvaXcWgAYOejSDBY+mZaLjCdRdv4NJDh9dVdd6ous8gdLIoEHjbSTOaEmz2R1lEu3V1dPzId7zk5MSW0fw/fX9Ejn2u69JUp5hUjU6By5cZN+TkP+XM0SSejgfG6aV7H/rBet+A9A5xeUarsSP75yJDW3y24GYalQ2idqhst81eAQgKDtUKrHYKDqhRXCMNVeDOtQsjM6Jfj1I3IcbLwf+qOJxBqLbhBCmOj; bm_sz=752F5036FEA67DB63E50AD91224308CF~YAAQdkInO/7SV7x9AQAAwWu31Q4IJ06HIcas6/iIuWkHF+61GuOdSy7K2NyIFAB2imDJ8YgLxF9GVEjf89MH6uzDCn+oG6xUKFwu5tYKUNohFbUkIhOwXr8ynnx+fwIOLImeF5PdQCB4E6fi+iE/RGkWuk7SjmC63l7aCwIL+oU285pxRKcsmaENwGx5NmVZPOgcfxJ2V7KbCztYwNPqTLsgay91Lh56Lhrvo25S0d9Z1qm2O5J57oxfWvn3qc16bjw2jKU+JaHbRMaOaCeaopVtw4igAGI5FQCefEKf3xu6R4urvjWTlrx4p9EXhK/Go7PUoUzZbB+MNfD1pgfIeB7Zhz7Wsc/Bd2nWGxlTYyA0zswlx49LeariLKlnHmQcZuDRbEVU2jD0HxGzxZbTROEQ~4604484~4470582; bm_sv=DD6F20D716E00072C518B694D2518450~BEMafJ6aEc/pDjrvJCTTSXW0E2Mq3gVyqIaNZroA9oAl6J+Fzy4MMLxn/ONm1VSe7BhYuyEOdaoP3zwjrQdDb1B+j/f6ysLay8gnRkgpRCHaqgq/57F/O763vFcQ8t3HoQGJ++L7HJrp41+8oUuvr2pryjO1xien4H4N9QXwkkU=; ti_rid=11344079')
            .end((err, res) => {
                if (err) {
                    return reject(err);
                }
                resolve(res.text);
            });
    });
}
exports.httpProxyGet6 = httpProxyGet6;

exports.httpProxyGet3 = async (url, proxy, serial) => {

	const agent = new HttpsProxyAgent(proxy);

	logger('url', url);

	let cookie_arr = ['_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo=\"CN\"; user_pref_currency=\"CNY\"; _fbp=fb.2.1636048547960.508365719; user_pref_language=\"zh-CN\"; alias=sys-null-null-cninfra_uhv-bhp-pp-null-cn; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.55%20Safari%2f537.36; ti_bm=; user_pref_givenNameLocalLanguage=\"%E6%B3%BD%E8%B1%AA\"; login-check=null; acceleratorSecureGUID=d3d76ad574e466b91f18133422294ab1960a7a1d; auth_session=qmnMdQs4DDBskN_4.y02UFVAQoheHYU6rMoV4nZXL38FnhWNyo636h8iqO8DbRNYuR4U3G7QA4HpM_Kh-NVgn5cHTudk0t1vhqer-BqkoqOtLiUMU_A50Jsa2N05dIeerIN0UQ7udhWPAxvjVIY0Ji7WLrud1JuYqMGlu1nZ_lWEipNxo3cAE_v8Ar9FkpSDpl4UACltUQkJY4QowWllHzsWiKMnsiIK7IEtTbZacbcuvqYjDfOTs76l1smvd52fe-DzM1jJvYbkgRFvEw_zPtXrfgWLapR9WDkpjmjWcWroquWWha3u_VlFa91KzoWpDrxaistegG4E1gJ5KFmqJdRPA6CwKGWhRCdMrGUPIl4V6Curd5YiQjO0juRofGKkdU3qQYXGfxHk0np4p6A_nq5UuOBqzL2u3LJwdgdhS7m5jzDoqw6AIkBJulbrmvw30gSkPT-QDuAdRaA_AL-jUmavit9WqKVdl59aFvLV7NRCChNekyUdcYkxqLgo7Q-otA5H0hleOUBv5njZL7vxmw2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YAZyWhOQTVeBJNq-aTKqb_KiKX_KG3uccXK-d-w4wl-0w3D5qh2qemDAmKfH64YQkWzFX3FdSh2OqZZPMqm7141xQ3CXKTmwxkqv_QHluK6jxU420Q.JDqYuJmklaPm0akAFTjv5A; _gid=GA1.3.1282257837.1638296294; user_pref_givenName=\"Xiaoying\"; login-check=null; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20211108%3A22%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20211108%3A22%7CG3YHLXUICZC3XKDXYVVLO4%3A20211108%3A22; user_pref_permanentId=\"6887527\"; user_pref_uid=\"maze@thunderchip.com\"; last-domain=www.ti.com.cn; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; auth_state_hAFEp5TN1i1LthbCYqHPP4NDRq8=oc80DYGo8TXd5qEI.bBwSeLnTCimmouKCGWfzp-hbaYidh5QX9_CRc66n8m2zSFWG0TYVkxLCn3FWmtV633MExURsN9CUctlVL5i7M9hlIGhRrTAwAGUtuiB2bToAZp91cTVL3O6XJ53Zjepx_zG5PCV50Bv4crjL11U_LZmGAxh5vUj-EWWnTxXN7fEQkZOF62DZXulu79DBoKgUGjfo0dpOGxH_qnk-zY-gJtxHDvZPcDC_DWUFfetmNAhI3S_w2AT6W-VDvca6RCzK5eTVQMCbAs1S4d7c1gGGiqg-dhV8mI0qT61LDhWZfFewxrhqX1VnelgkoWPBdFDiy7GokCnv6U8eHjLFtTmwAizWinz0KEq8rdEQIdi2bPfabIHEWD4sgaMdRY5b9VQXu9TP7JvyxLmo4-OI5YS9y_LH-y4N69hTRNSqGzFHMdDU_KcaOTv4m_WF8n1vXV27o8gPAhcafx4eYAirn1ckl2gl.VJ6dFzfQ0lniW5QXKkjshA; tipage=%2Ftistore%2Fproduct%20page%20PINA350ABSIDDFR%20zh; tipageshort=product%20page%20PINA350ABSIDDFR%20zh; ticontent=%2Ftistore; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1638500797125&cst=1638533538216&ns=64&pvt=513&pvis=1&th=686831.851794.297.1.21.1.1626858218035.1638533538271.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:77$_ss:1$_st:1638535369954$free_trial:false$dc_visit:67$channel:organic%3Bexp-1638640546376$ctimestamp:Fri%20Nov%2005%202021%2001%3A55%3A46%20GMT%2B0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)%3Bexp-1638640546376$_pn:1%3Bexp-session$ses_id:1638533536978%3Bexp-session; _abck=C446E9D5801784995040171CCA462AB3~-1~YAAQe0InOyWT8V99AQAAQZeJgwcwa58JfQVDxQYsvRpGElFfJGTFItFqxRnDK6Q4VPDg4u4idtdyggADyulG/5zU7s7kpT29Z7sg6p5vR2Vd1gRNDr2pylC+EfbWz27EVMkBU/FAUkMJgbaFB0T4m5qskDAB81f+0omnDc6tg81SLdvP8mAo0aE1gTvKFAm005gG02g1ncK1cWX4yZPB9g7qO4ztNK8brsdX1SqFuwEu4MLMMUfq4Kdrfhi4A9aGuNgGMgBCM4BjrDVcP6ebRl1Vp4Apkap/idU/Tyldv1WMqa4OEo1E4QqS+ov9dbtMKytvQmHcMKepNtlpkkmOOe+MhFoZNSC4ke0TSmJNjQGAjBd/WuXcAU/U6zNtfZugNQZVZ30Sz47OYm3JMYY3TUkuku3VGNAO2Kd0ub5IsvMXATlunNZpy+QLIjd0rG1/OydJGz57Ls3z6Bu1ztJEF86MeQ==~-1~-1~-1; ak_bmsc=E201BF51C033833480797277F3CFEDD2~000000000000000000000000000000~YAAQe0InOyaT8V99AQAAQZeJgw6Q9WsECvQzqCMCvqJHiDfHZoa/Lr22OHOE+iNwwh7WaCtZjaWozmidZABQ/jBPT97cWbPA1/U+SoAOmdlMv3qLls8Fbt1CZJLsiikZQ6s0Tv0+LoNlf7C56GUoe9D4+IHm57AE4jhXu6uNgkvaVUAD/CGNRaElJyJN0BlCdteUPa3I7ZZ2jP8VAHDJkuBnWQc16kiPD4wmUILO0xRboCqRD5JossAvTSEzSFRSLng6hz3g8YxXIW8Xt/xN3ASYPMfsdZ3xgq63ykUyP+hLuuKgy9UaNgeNyzdv9tPl9ZBVKvdBHekOyXum+Kn8xoMdjQQwt4149UrZMb1DWGmNV4yyU44gY304TG4/5ceMFGeeEJmqdBg=; bm_sz=3E5B243DE25B98DCC99374F45BF8E2A1~YAAQe0InOyeT8V99AQAAQZeJgw7rWfp9EMSuE18/qa9vEEvWEVl9mnNgLJfmBfdQP8PTcKa3ED+NmWGDBqG3hi/IkRj1yxGLblUh/nCuT9mKNiwKHUZD3mHtovtoDacbO3pW7v1KcAFzObRwbL7EKeABlz3CrZX8HBbzeWgidaup4/HxKPMF14SRMTlnv+B5mqxuQ7Iwson8fb0qxAOtAVjeQKPJOkvvdBt7QhWEEdj0bM3J9j8j/5f6bJL2kGccCrFqFhZuxkCdjPXEkx/zc1ngwC7qBaDAnRFaSrGNabNUGzorXR5BBUTwYN8EOB4Otvbgwuu8VocwBEslWPx8iDzp+jKFF3QyY1bICNLKQUPbgFXGQ9CTEu31CHA8luVxZZ1KTp720j+XFEyJxYeHoBxw~3684152~3687747; bm_sv=299ECBFDA85F3D12082FEFDA14392BBD~7/F9Uu3GKeTsJyZG6lwj0hnNVYsQSQEpJ0HpcYKUVKEqwJgG/Vb3F6HJbCkiiS8R5hlp7l7xEK6WuZgRjUa9Jpw0B0YGVx1ez4oidMklFRhHiIyi6i6vJOBoHBIFyt5NLT34qOu1P1HGnwJ4EfQqcezqJ8D65Rd5NrZKrpyM8H8=; ti_rid=1ab8c702',
					 '_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo=\"CN\"; user_pref_currency=\"CNY\"; _fbp=fb.2.1636048547960.508365719; user_pref_language=\"zh-CN\"; alias=sys-null-null-cninfra_uhv-bhp-pp-null-cn; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.55%20Safari%2f537.36; ti_bm=; user_pref_givenNameLocalLanguage=\"%E6%B3%BD%E8%B1%AA\"; login-check=null; acceleratorSecureGUID=d3d76ad574e466b91f18133422294ab1960a7a1d; auth_session=qmnMdQs4DDBskN_4.y02UFVAQoheHYU6rMoV4nZXL38FnhWNyo636h8iqO8DbRNYuR4U3G7QA4HpM_Kh-NVgn5cHTudk0t1vhqer-BqkoqOtLiUMU_A50Jsa2N05dIeerIN0UQ7udhWPAxvjVIY0Ji7WLrud1JuYqMGlu1nZ_lWEipNxo3cAE_v8Ar9FkpSDpl4UACltUQkJY4QowWllHzsWiKMnsiIK7IEtTbZacbcuvqYjDfOTs76l1smvd52fe-DzM1jJvYbkgRFvEw_zPtXrfgWLapR9WDkpjmjWcWroquWWha3u_VlFa91KzoWpDrxaistegG4E1gJ5KFmqJdRPA6CwKGWhRCdMrGUPIl4V6Curd5YiQjO0juRofGKkdU3qQYXGfxHk0np4p6A_nq5UuOBqzL2u3LJwdgdhS7m5jzDoqw6AIkBJulbrmvw30gSkPT-QDuAdRaA_AL-jUmavit9WqKVdl59aFvLV7NRCChNekyUdcYkxqLgo7Q-otA5H0hleOUBv5njZL7vxmw2I9TDNUKYQ864uBtyoEO1g-16wBKonQ7ftN9dh0DMIme9YuVSbH5pBO9cxe0wmkoFSKHbMMcJd7IFFDhXSpf-8oMZsVE7jKuSQSbpr8VWrWxQ7zUreW6jO9riInKHe9ZVN6wE9WJt9QNCnyhzrCfBLzAZbRcFH9f65YNKV-3MzxVdIBGzqbQoSDkOq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z=73E0FE81A2C50B6265E3EA2B797DB047~YAAQLQrgemkIx0F9AQAAN/BBfg08WbzPEE8d/Bq0+Dj915EOa6nUibLxsE2toOdCwt/HY4EMBDlZ0wfh1Ci1N18L4le0lsiccKQZkuvw/bSJ+GfY3xYX6V/unZpG1LooP627itBD6iQ5d6vNHwxQ9UCul4TLMtA5HsTVEIaSJX3o43hp3I0wcp2f9v9lNEOHNe9OBiZDvRLisoUECdD3DQhXVskTUyXtpAzYW2mlohNUFDOBv0fATlmy9rakQMjukryWc6oNS1G6dpw/IJmifN4xytNzqjiCOEj6kOvddzDmCJKDESI+8RnKi7XCsLctfulO1PC2iwZXjQ/7UP1uWVSdBURQ7lJ62c5iLtbOGHKd0FX559a+P4GdtLPiSzMLUpG6djaDfaKACE8lOEVJhRfa8w==~3158582~3486018; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20211108%3A22%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20211108%3A22%7CG3YHLXUICZC3XKDXYVVLO4%3A20211108%3A22; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; user_pref_permanentId=\"6887527\"; user_pref_uid=\"maze@thunderchip.com\"; last-domain=www.ti.com.cn; tipage=%2Ftistore%2Fproduct%20page%20PINA350ABSIDDFR%20zh; tipageshort=product%20page%20PINA350ABSIDDFR%20zh; ticontent=%2Ftistore; auth_state_BXkqLzjsFI3KG-5CAnVFw8jJcv0=c4BFVRHcFfxbsyEW.yniENl4LbbQaZjeseNUlrUMUSLC9OP_DUcih4Ja5BSNkZ2KiPiYvd-bt7YIDIGZrJY7go9ik7DevNljoH4JeLFet4eZbZn6RU6UPHefzm0Jp8JfW46y1tyYJHSmZAMOuLKS31uvYrfoxKvdbt9PHYrBqhLo3vgPbJCdzQuRowbfMiWJYMeCz0EhSUdyiulFTJmAqUYppYOPbNZH4J8-pp7EX7j0j13XvaPRCmVn18fAD43tY697yELqkSjm23dIqrzdTYoljyZ9cBjMpV5PpiMMf-5FW_KKa36tamkr3SQUY2bQCXU9K148pp-Ko-53W_Qjp3SSFuOxKNTElbOorNkGDudegq0PsaFIACRZ8bAuEF45fiu36H6RgRNbOVhP8bOXxJWYjXTebTc7ioYLyqXN6eAOwYMzAHl8U7Ry8b0kEogdmN2qg2YCNR4lDCVHNtRhyYOkNZSKTpWpP6TA4H7GT.TVk7NgLiR5wVCmERH91zoQ; _abck=C446E9D5801784995040171CCA462AB3~-1~YAAQHwrgeo8+OUd9AQAA7I9HfgZOM2MihuiMhEpROg/gNl1uoKcJQdZZkMl7E83n0rrAOELfxrKl0sUhT373m6nOmnmIIU+5qvYCI0YsAED5kAX7hpLhL1J13MvNb+u0HfiL2IEZ9otkK1z7s1sM+oxf5pfmfh+Cjycf+OdnqIO3YpWkiiizC+nfF2RHETnHmNYCPtMCm+OBssSFiZQNeZV1mAIz+CLneTOwGbFrxERBGTIOd7tI1iSIdW1fWWp59QgI760qRBzPetEDHKk70B7nMwi1E3lloG/DUhlDa3Ffyw3nPq3xtyyJ24MNiMogU4+PcZFy7kjkGXK3lcgPzZxwX3gbVsEygP9AOX70NVVTjv8qQNl9KAKFJJrf9N4zylwedw27+m63Bk03vqfhKWjbh/YFMNvxhAjCqKlxrY60XDcsGSdz/OueW4LsEt5tCnnOJGJcOfD/thovhxI8uiNieg==~-1~-1~-1; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1638448362984&cst=1638500797125&ns=63&pvt=509&pvis=5&th=686831.851794.292.20.20.1.1626858218035.1638200937504.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:75$_ss:0$_st:1638502947743$free_trial:false$dc_visit:66$channel:organic%3Bexp-1638640546376$ctimestamp:Fri%20Nov%2005%202021%2001%3A55%3A46%20GMT%2B0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)%3Bexp-1638640546376$_pn:5%3Bexp-session$ses_id:1638500796137%3Bexp-session$dc_event:4%3Bexp-session$dc_region:ap-east-1%3Bexp-session; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; ak_bmsc=25AE9E9B5AAE6DE71ACF8EF0F672183E~000000000000000000000000000000~YAAQ5IvytmOf8yd9AQAAFSXmfg0ipxvJO9MKfULm9ZV7N7rpLGo31cZ2LBjRQG+pz/Izg/bWfm2eWCjRcX6qMFmxw+tg4N3GEP0qH//eJk8bEphiHz87rmnwrK9uNRQ1kKTrUEj0rSXJupADCtq2M55esrTG18oAXV/jmXqQINgtcM+DeQI+am2n4oayPMTRXUdU3i1iy/iOAiF3KWsCqPqmzcOMK9GaYFEI1uxDOYzDr61yq1z1YTzOAwrYvMge3XecdFNem1x69CXUmOKteMAppWx1b0ApUjDdisg/ThF3ErekqNnDRiMX1fBbk+Vwgt/ST2kk19CV4QvssY75a2rvkdvZCg2/IKz8vfAh34FEJ2AcAdaTd58TfdiXKUrIwtw34g3irK8=; ti_rid=33a412b3; bm_sv=D4B3E0A76B30922CC5162078EB582374~5lMrVqCs8L1aeR0fDZC1gEftmPhAaTyaIE554l5G2IHOcKZBJ4P9NkWUXaBxsd7d4FQZW+pIzze4mZLovvncxNoe0zmzbDlKxJYDh8rG4wDqOsg6CJ5S9pmhqDvUXm5QJ+qXPuP1Q0iMytvAMxqxjIrQuACAYJKdhU6OHnBO+2Q=',
					 'CONSENTMGR=ts:1638590855571%7Cconsent:true; ga_content_cookie=%2Fmain%20home%20page; ga_page_cookie=main%20home%20page-en; tiSessionID=017d83a03995001da44687958ee601077001606f0093c; userType=Anonymous; utag_main=v_id:017d83a03995001da44687958ee601077001606f0093c$_sn:1$_ss:1$_pn:1%3Bexp-session$_st:1638592684486$ses_id:1638590855573%3Bexp-session$free_trial:false; _abck=D1D16B71B5A0041E11F347A3E7027CF3~-1~YAAQe0InOwfJ8199AQAAzIyggwcjAbxxc16lu8WDyseRPjuQZ937GoPSqYeLTqYmTRcExtao6/9jNyDIc6jyA0vjZs7dOgiU5YhZW3gJ1f/iyB2DPgbOpNDLhvR3s6A0FTTIDu4O4QEYn3wh60Q6Msju81/vEz1o2GiXWrhLGgIzJDjjqGHMzApFohKkvHbt1Skf+8yFdi2xUe3vRJzv56Zno/yKq+OInz6yInyDnlPNsifWJhUe5ur0pjgVwMdcF/G4q3Wb4WyGUOAdk4Fm5zul+FpHQH8DYVuTptBabmhKKgelf6tdqYf9xxykMNVSmIcbFDxOZrUaMHblwes8y9tvcXwiJ7j8zqlzZhV/1s8LXvAXEyRUPSHDUsmvckduQC4w13hissGSbdIZaOaJBKDeXv1OY45tA6CnIJYMoIIS8pqIm+NfJ2Zs3+kQbU+t1we+aIO4C5cTuXVBBXp6UjcZjCe/iREzYE+kZX9b6bc=~-1~-1~-1; ti_bm=; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; ti_rid=24a42dd3; ABTasty=uid=pc7g0ygt0n9s2xcr&fst=1633679313663&pst=1637753857000&cst=1638590856425&ns=13&pvt=102&pvis=1&th=686831.851794.83.10.4.1.1633679318774.1636363793732.1; ABTastySession=mrasn=&sen=0&lp=https%253A%252F%252Fwww.ti.com.cn%252F; _ga=GA1.3.835908250.1638590856; _gat_ga_main_tracker=1; _gid=GA1.3.347776160.1638590856; bm_sv=252117522B1850B91EF5B7F35A757AF3~7/F9Uu3GKeTsJyZG6lwj0uFGAbmxYYYNYIlgxcbK9kT/9rdihn8gU+sp/579PaSja2ERCjYccudd+/L4CO29ZyIXdOpi5r6mlQosGMiRAeM6yhikGdDDlSOSoW1WzyhFw1sW31Uhi61+qYSLAUmL8VxQEsHQ1QZ3nRE8QWLOBx8=; ak_bmsc=9D86259D1B6D249796A94F858DBA715B~000000000000000000000000000000~YAAQe0InO4DG8199AQAAYXKggw61k15hule4iKOUo17NpGh2JAF+xhDcb+Z+H08b6Pr07KaJg+henMf/9GZMjBbtt9fAioUxGbAcOG2MwZc9PhZSjvf9z5LexBjpg1l+bqonFrIT7HCxS8FuNRxShsCjLJ7gB/fgdoq8koK7lAjVz2QMd5ZhJhQtjuzfxU+ALd48IoEuyLhRCJoyiiXd+o9x9rRQdCUnZlz0T11dT+sPGweGiCbgPb9STCUcescwMnRQCf6eSoiHj1S7EIXJlSDeHnFHNzQk7OPq5uBTK87NyYRuojleLdF4azGeZ4CAU1EsLcFqj79T38dJxXyNg4p6VYPWlcK3YGZuEsaUG87cf6UAusLAXFIp88UK5huOFgv+D6oc3sgFLiZgPDMfVQYycNS4zu+nDjYguEJNaZqffzRbwYzOBjZ6nHi/g1+KqiB8U2clViAh08hvV17SpRmHlZUqZW4=; gpn=Non-Product; ticontent=%2Fmain%20home%20page; tipage=%2Fmain%20home%20page%2Fmain%20home%20page-en; tipageshort=main%20home%20page-en; bm_mi=4D2AFAEA132031C2F9A705902BE9A588~TEOoid8tTbGHbWLqvpVFVjNd5w14eJJ9VU1GdNPEmU8Tu0MngRYJr5oAtixUeE1dcUQsLTUWXcyzHqN1qfrIKpAIb8bZUqnY3bDpZdSRFmlRR8WnBO+zmrJpeXtRZGFPbM+O/AqeCB82kZpkfwsIPPgkFqA/lHuCLsGz2KkSy/m6hPVkc3DtFxxcnaX9DkaNsOJEgOq1G9a4nwgMgd5rDxUnXkvWsBKiIjsw4z+J8krQgeySJ1acy9yR8vNSv1qdUP6IXrVn/36zRtw9s3ueNQ==; bm_sz=7AA0EB61F91B69AFD9C04FA465AC187E~YAAQe0InO6bC8199AQAAjkaggw4Ugz3wcnWwXQoav69FOe+1oEuQzcl5G14ML04yW1Fm90i1OJfG8etxbCOtJAtuuA7fzRRHsjNTrTsWVWC9qVdXCmAKQXWgpYC7TB2kQnaVzs+vjzD1SL62vcaKvxq3UpEuZNIqF6EGpz0IGVUnE4JHNVm0BkEuxi9/43T19HuH0vhT5xNbJPLYbOF9zinLRNppU5YR8+h+98ztxzvBWlqlcHxx38Rw5hjXusV11qxgw/lpT3oDUEWT7qfUDf4x2r6xBPliKCPLAlPnlCpdsEhIFTcsJC1eEKzsb9gXE+vyPRECkl9CcbImZ31pgyn5bMSLRR0PQbpNnZi9V5p+J1Qf3ce0mScn4Dbb3jwnEKxmX3DUkcd7AC/R42HwCfbN~3487792~4470342; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f605.1.15%20(KHTML,%20like%20Gecko)%20Version%2f14.1.2%20Safari%2f605.1.15; user_pref_currency="CNY"; user_pref_language="en-US"; user_pref_shipTo="CN"; last-domain=www.ti.com.cn; ELOQUA=GUID=68C7D27FE40344619BAD878A2EEB7031'];

	let index = randBetween(0, 2);

	let cookie = cookie_arr[index];

	let key = 'set_cookie_'+serial+'_'+proxy;

	let set_cookie = await get(key);

	// if(!set_cookie){

	//  	set_cookie = await Promise.race([
 //                    httpProxyGet4('https://www.ti.com.cn/', proxy),
 //                    sleep(4000)
 //                ]);

	//  	if(set_cookie){
	//  		await set(key, JSON.stringify(set_cookie));

	//  		await expire(key, 600);
	//  	}
	 	

	// }else{
	// 	set_cookie = JSON.parse(set_cookie);
	// }

	// logger('cookie=', cookie.substring(0, 10));

	let res = '';
	try{

		res = await got(
            url,
            {
                headers: {
                    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
				    "accept-language": "zh-CN,zh;q=0.9",
				    "cache-control": "no-cache",
				    "pragma": "no-cache",
				    "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Google Chrome\";v=\"96\"",
				    "sec-ch-ua-mobile": "?0",
				    "sec-ch-ua-platform": "\"macOS\"",
				    "sec-fetch-dest": "document",
				    "sec-fetch-mode": "navigate",
				    "sec-fetch-site": "none",
				    "sec-fetch-user": "?1",
				    "upgrade-insecure-requests": "1"
                },
                timeout: {
					request: 7000
				},
                agent: {
                    http: agent,
                    https: agent
                }
            }
        ).json();
	}catch(e){
		//logger('url2', url);
		logger('error', e);
	}	

	//logger('url3', url);

	logger('res', res);

	return res;
}

const httpProxyGet4 = async (url, proxy) => {

	const agent = new HttpsProxyAgent(proxy);

	//logger('url33', url);

	let cookie_arr = ['_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo=\"CN\"; user_pref_currency=\"CNY\"; _fbp=fb.2.1636048547960.508365719; user_pref_language=\"zh-CN\"; alias=sys-null-null-cninfra_uhv-bhp-pp-null-cn; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.55%20Safari%2f537.36; ti_bm=; user_pref_givenNameLocalLanguage=\"%E6%B3%BD%E8%B1%AA\"; login-check=null; acceleratorSecureGUID=d3d76ad574e466b91f18133422294ab1960a7a1d; auth_session=qmnMdQs4DDBskN_4.y02UFVAQoheHYU6rMoV4nZXL38FnhWNyo636h8iqO8DbRNYuR4U3G7QA4HpM_Kh-NVgn5cHTudk0t1vhqer-BqkoqOtLiUMU_A50Jsa2N05dIeerIN0UQ7udhWPAxvjVIY0Ji7WLrud1JuYqMGlu1nZ_lWEipNxo3cAE_v8Ar9FkpSDpl4UACltUQkJY4QowWllHzsWiKMnsiIK7IEtTbZacbcuvqYjDfOTs76l1smvd52fe-DzM1jJvYbkgRFvEw_zPtXrfgWLapR9WDkpjmjWcWroquWWha3u_VlFa91KzoWpDrxaistegG4E1gJ5KFmqJdRPA6CwKGWhRCdMrGUPIl4V6Curd5YiQjO0juRofGKkdU3qQYXGfxHk0np4p6A_nq5UuOBqzL2u3LJwdgdhS7m5jzDoqw6AIkBJulbrmvw30gSkPT-QDuAdRaA_AL-jUmavit9WqKVdl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i9_kAtzhyFKd1EHUMSvCEJwiqkPN6rMyqrYw5aCxYdFf-WzyCYAZyWhOQTVeBJNq-aTKqb_KiKX_KG3uccXK-d-w4wl-0w3D5qh2qemDAmKfH64YQkWzFX3FdSh2OqZZPMqm7141xQ3CXKTmwxkqv_QHluK6jxU420Q.JDqYuJmklaPm0akAFTjv5A; _gid=GA1.3.1282257837.1638296294; user_pref_givenName=\"Xiaoying\"; login-check=null; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20211108%3A22%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20211108%3A22%7CG3YHLXUICZC3XKDXYVVLO4%3A20211108%3A22; user_pref_permanentId=\"6887527\"; user_pref_uid=\"maze@thunderchip.com\"; last-domain=www.ti.com.cn; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; auth_state_hAFEp5TN1i1LthbCYqHPP4NDRq8=oc80DYGo8TXd5qEI.bBwSeLnTCimmouKCGWfzp-hbaYidh5QX9_CRc66n8m2zSFWG0TYVkxLCn3FWmtV633MExURsN9CUctlVL5i7M9hlIGhRrTAwAGUtuiB2bToAZp91cTVL3O6XJ53Zjepx_zG5PCV50Bv4crjL11U_LZmGAxh5vUj-EWWnTxXN7fEQkZOF62DZXulu79DBoKgUGjfo0dpOGxH_qnk-zY-gJtxHDvZPcDC_DWUFfetmNAhI3S_w2AT6W-VDvca6RCzK5eTVQMCbAs1S4d7c1gGGiqg-dhV8mI0qT61LDhWZfFewxrhqX1VnelgkoWPBdFDiy7GokCnv6U8eHjLFtTmwAizWinz0KEq8rdEQIdi2bPfabIHEWD4sgaMdRY5b9VQXu9TP7JvyxLmo4-OI5YS9y_LH-y4N69hTRNSqGzFHMdDU_KcaOTv4m_WF8n1vXV27o8gPAhcafx4eYAirn1ckl2gl.VJ6dFzfQ0lniW5QXKkjshA; tipage=%2Ftistore%2Fproduct%20page%20PINA350ABSIDDFR%20zh; tipageshort=product%20page%20PINA350ABSIDDFR%20zh; ticontent=%2Ftistore; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1638500797125&cst=1638533538216&ns=64&pvt=513&pvis=1&th=686831.851794.297.1.21.1.1626858218035.1638533538271.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:77$_ss:1$_st:1638535369954$free_trial:false$dc_visit:67$channel:organic%3Bexp-1638640546376$ctimestamp:Fri%20Nov%2005%202021%2001%3A55%3A46%20GMT%2B0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)%3Bexp-1638640546376$_pn:1%3Bexp-session$ses_id:1638533536978%3Bexp-session; _abck=C446E9D5801784995040171CCA462AB3~-1~YAAQe0InOyWT8V99AQAAQZeJgwcwa58JfQVDxQYsvRpGElFfJGTFItFqxRnDK6Q4VPDg4u4idtdyggADyulG/5zU7s7kpT29Z7sg6p5vR2Vd1gRNDr2pylC+EfbWz27EVMkBU/FAUkMJgbaFB0T4m5qskDAB81f+0omnDc6tg81SLdvP8mAo0aE1gTvKFAm005gG02g1ncK1cWX4yZPB9g7qO4ztNK8brsdX1SqFuwEu4MLMMUfq4Kdrfhi4A9aGuNgGMgBCM4BjrDVcP6ebRl1Vp4Apkap/idU/Tyldv1WMqa4OEo1E4QqS+ov9dbtMKytvQmHcMKepNtlpkkmOOe+MhFoZNSC4ke0TSmJNjQGAjBd/WuXcAU/U6zNtfZugNQZVZ30Sz47OYm3JMYY3TUkuku3VGNAO2Kd0ub5IsvMXATlunNZpy+QLIjd0rG1/OydJGz57Ls3z6Bu1ztJEF86MeQ==~-1~-1~-1; ak_bmsc=E201BF51C033833480797277F3CFEDD2~000000000000000000000000000000~YAAQe0InOyaT8V99AQAAQZeJgw6Q9WsECvQzqCMCvqJHiDfHZoa/Lr22OHOE+iNwwh7WaCtZjaWozmidZABQ/jBPT97cWbPA1/U+SoAOmdlMv3qLls8Fbt1CZJLsiikZQ6s0Tv0+LoNlf7C56GUoe9D4+IHm57AE4jhXu6uNgkvaVUAD/CGNRaElJyJN0BlCdteUPa3I7ZZ2jP8VAHDJkuBnWQc16kiPD4wmUILO0xRboCqRD5JossAvTSEzSFRSLng6hz3g8YxXIW8Xt/xN3ASYPMfsdZ3xgq63ykUyP+hLuuKgy9UaNgeNyzdv9tPl9ZBVKvdBHekOyXum+Kn8xoMdjQQwt4149UrZMb1DWGmNV4yyU44gY304TG4/5ceMFGeeEJmqdBg=; bm_sz=3E5B243DE25B98DCC99374F45BF8E2A1~YAAQe0InOyeT8V99AQAAQZeJgw7rWfp9EMSuE18/qa9vEEvWEVl9mnNgLJfmBfdQP8PTcKa3ED+NmWGDBqG3hi/IkRj1yxGLblUh/nCuT9mKNiwKHUZD3mHtovtoDacbO3pW7v1KcAFzObRwbL7EKeABlz3CrZX8HBbzeWgidaup4/HxKPMF14SRMTlnv+B5mqxuQ7Iwson8fb0qxAOtAVjeQKPJOkvvdBt7QhWEEdj0bM3J9j8j/5f6bJL2kGccCrFqFhZuxkCdjPXEkx/zc1ngwC7qBaDAnRFaSrGNabNUGzorXR5BBUTwYN8EOB4Otvbgwuu8VocwBEslWPx8iDzp+jKFF3QyY1bICNLKQUPbgFXGQ9CTEu31CHA8luVxZZ1KTp720j+XFEyJxYeHoBxw~3684152~3687747; bm_sv=299ECBFDA85F3D12082FEFDA14392BBD~7/F9Uu3GKeTsJyZG6lwj0hnNVYsQSQEpJ0HpcYKUVKEqwJgG/Vb3F6HJbCkiiS8R5hlp7l7xEK6WuZgRjUa9Jpw0B0YGVx1ez4oidMklFRhHiIyi6i6vJOBoHBIFyt5NLT34qOu1P1HGnwJ4EfQqcezqJ8D65Rd5NrZKrpyM8H8=; ti_rid=1ab8c702',
					 '_ga=GA1.3.477390357.1626857730; ELOQUA=GUID=F915935CD92F4B76B042F6C1601243C6; __adroll_fpc=173589a121e46c49026661b8d685e18d-1626857998685; CONSENTMGR=ts:1633675597897%7Cconsent:true; coveo_visitorId=f2690004-af71-4488-8ae1-835dfb89e48e; _gcl_au=1.1.57629291.1635065929; tiSessionID=lita4c81440a4c81440a4c8144061751ec3340c8ffe; user_pref_shipTo=\"CN\"; user_pref_currency=\"CNY\"; _fbp=fb.2.1636048547960.508365719; user_pref_language=\"zh-CN\"; alias=sys-null-null-cninfra_uhv-bhp-pp-null-cn; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f537.36%20(KHTML,%20like%20Gecko)%20Chrome%2f96.0.4664.55%20Safari%2f537.36; ti_bm=; user_pref_givenNameLocalLanguage=\"%E6%B3%BD%E8%B1%AA\"; login-check=null; acceleratorSecureGUID=d3d76ad574e466b91f18133422294ab1960a7a1d; auth_session=qmnMdQs4DDBskN_4.y02UFVAQoheHYU6rMoV4nZXL38FnhWNyo636h8iqO8DbRNYuR4U3G7QA4HpM_Kh-NVgn5cHTudk0t1vhqer-BqkoqOtLiUMU_A50Jsa2N05dIeerIN0UQ7udhWPAxvjVIY0Ji7WLrud1JuYqMGlu1nZ_lWEipNxo3cAE_v8Ar9FkpSDpl4UACltUQkJY4QowWllHzsWiKMnsiIK7IEtTbZacbcuvqYjDfOTs76l1smvd52fe-DzM1jJvYbkgRFvEw_zPtXrfgWLapR9WDkpjmjWcWroquWWha3u_VlFa91KzoWpDrxaistegG4E1gJ5KFmqJdRPA6CwKGWhRCdMrGUPIl4V6Curd5YiQjO0juRofGKkdU3qQYXGfxHk0np4p6A_nq5UuOBqzL2u3LJwdgdhS7m5jzDoqw6AIkBJulbrmvw30gSkPT-QDuAdRaA_AL-jUmavit9WqKVdl59aFvLV7NRCChNekyUdcYkxqLgo7Q-otA5H0hleOUBv5njZL7vxmw2I9TDNUKYQ864uBtyoEO1g-16wBKonQ7ftN9dh0DMIme9YuVSbH5pBO9cxe0wmkoFSKHbMMcJd7IFFDhXSpf-8oMZsVE7jKuSQSbpr8VWrWxQ7zUreW6jO9riInKHe9ZVN6wE9WJ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gid=GA1.3.1282257837.1638296294; user_pref_givenName=\"Xiaoying\"; login-check=null; bm_sz=73E0FE81A2C50B6265E3EA2B797DB047~YAAQLQrgemkIx0F9AQAAN/BBfg08WbzPEE8d/Bq0+Dj915EOa6nUibLxsE2toOdCwt/HY4EMBDlZ0wfh1Ci1N18L4le0lsiccKQZkuvw/bSJ+GfY3xYX6V/unZpG1LooP627itBD6iQ5d6vNHwxQ9UCul4TLMtA5HsTVEIaSJX3o43hp3I0wcp2f9v9lNEOHNe9OBiZDvRLisoUECdD3DQhXVskTUyXtpAzYW2mlohNUFDOBv0fATlmy9rakQMjukryWc6oNS1G6dpw/IJmifN4xytNzqjiCOEj6kOvddzDmCJKDESI+8RnKi7XCsLctfulO1PC2iwZXjQ/7UP1uWVSdBURQ7lJ62c5iLtbOGHKd0FX559a+P4GdtLPiSzMLUpG6djaDfaKACE8lOEVJhRfa8w==~3158582~3486018; __ar_v4=QFXRHQEHOJDMLHSLFIWCLO%3A20211108%3A22%7C2XNKMR6P4VGD5MD3ZP4SQR%3A20211108%3A22%7CG3YHLXUICZC3XKDXYVVLO4%3A20211108%3A22; da_lid=BCDD00D89A73EA10C5ECBB990C9C75724E|0|0|0; user_pref_permanentId=\"6887527\"; user_pref_uid=\"maze@thunderchip.com\"; last-domain=www.ti.com.cn; tipage=%2Ftistore%2Fproduct%20page%20PINA350ABSIDDFR%20zh; tipageshort=product%20page%20PINA350ABSIDDFR%20zh; ticontent=%2Ftistore; auth_state_BXkqLzjsFI3KG-5CAnVFw8jJcv0=c4BFVRHcFfxbsyEW.yniENl4LbbQaZjeseNUlrUMUSLC9OP_DUcih4Ja5BSNkZ2KiPiYvd-bt7YIDIGZrJY7go9ik7DevNljoH4JeLFet4eZbZn6RU6UPHefzm0Jp8JfW46y1tyYJHSmZAMOuLKS31uvYrfoxKvdbt9PHYrBqhLo3vgPbJCdzQuRowbfMiWJYMeCz0EhSUdyiulFTJmAqUYppYOPbNZH4J8-pp7EX7j0j13XvaPRCmVn18fAD43tY697yELqkSjm23dIqrzdTYoljyZ9cBjMpV5PpiMMf-5FW_KKa36tamkr3SQUY2bQCXU9K148pp-Ko-53W_Qjp3SSFuOxKNTElbOorNkGDudegq0PsaFIACRZ8bAuEF45fiu36H6RgRNbOVhP8bOXxJWYjXTebTc7ioYLyqXN6eAOwYMzAHl8U7Ry8b0kEogdmN2qg2YCNR4lDCVHNtRhyYOkNZSKTpWpP6TA4H7GT.TVk7NgLiR5wVCmERH91zoQ; _abck=C446E9D5801784995040171CCA462AB3~-1~YAAQHwrgeo8+OUd9AQAA7I9HfgZOM2MihuiMhEpROg/gNl1uoKcJQdZZkMl7E83n0rrAOELfxrKl0sUhT373m6nOmnmIIU+5qvYCI0YsAED5kAX7hpLhL1J13MvNb+u0HfiL2IEZ9otkK1z7s1sM+oxf5pfmfh+Cjycf+OdnqIO3YpWkiiizC+nfF2RHETnHmNYCPtMCm+OBssSFiZQNeZV1mAIz+CLneTOwGbFrxERBGTIOd7tI1iSIdW1fWWp59QgI760qRBzPetEDHKk70B7nMwi1E3lloG/DUhlDa3Ffyw3nPq3xtyyJ24MNiMogU4+PcZFy7kjkGXK3lcgPzZxwX3gbVsEygP9AOX70NVVTjv8qQNl9KAKFJJrf9N4zylwedw27+m63Bk03vqfhKWjbh/YFMNvxhAjCqKlxrY60XDcsGSdz/OueW4LsEt5tCnnOJGJcOfD/thovhxI8uiNieg==~-1~-1~-1; ABTasty=uid=bnpbzq1znnf42gn4&fst=1626857731522&pst=1638448362984&cst=1638500797125&ns=63&pvt=509&pvis=5&th=686831.851794.292.20.20.1.1626858218035.1638200937504.1; utag_main=v_id:017ac846ebf20002656c4c7e30890307900df0710093c$_sn:75$_ss:0$_st:1638502947743$free_trial:false$dc_visit:66$channel:organic%3Bexp-1638640546376$ctimestamp:Fri%20Nov%2005%202021%2001%3A55%3A46%20GMT%2B0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)%3Bexp-1638640546376$_pn:5%3Bexp-session$ses_id:1638500796137%3Bexp-session$dc_event:4%3Bexp-session$dc_region:ap-east-1%3Bexp-session; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; ak_bmsc=25AE9E9B5AAE6DE71ACF8EF0F672183E~000000000000000000000000000000~YAAQ5IvytmOf8yd9AQAAFSXmfg0ipxvJO9MKfULm9ZV7N7rpLGo31cZ2LBjRQG+pz/Izg/bWfm2eWCjRcX6qMFmxw+tg4N3GEP0qH//eJk8bEphiHz87rmnwrK9uNRQ1kKTrUEj0rSXJupADCtq2M55esrTG18oAXV/jmXqQINgtcM+DeQI+am2n4oayPMTRXUdU3i1iy/iOAiF3KWsCqPqmzcOMK9GaYFEI1uxDOYzDr61yq1z1YTzOAwrYvMge3XecdFNem1x69CXUmOKteMAppWx1b0ApUjDdisg/ThF3ErekqNnDRiMX1fBbk+Vwgt/ST2kk19CV4QvssY75a2rvkdvZCg2/IKz8vfAh34FEJ2AcAdaTd58TfdiXKUrIwtw34g3irK8=; ti_rid=33a412b3; bm_sv=D4B3E0A76B30922CC5162078EB582374~5lMrVqCs8L1aeR0fDZC1gEftmPhAaTyaIE554l5G2IHOcKZBJ4P9NkWUXaBxsd7d4FQZW+pIzze4mZLovvncxNoe0zmzbDlKxJYDh8rG4wDqOsg6CJ5S9pmhqDvUXm5QJ+qXPuP1Q0iMytvAMxqxjIrQuACAYJKdhU6OHnBO+2Q=',
					 'CONSENTMGR=ts:1638590855571%7Cconsent:true; ga_content_cookie=%2Fmain%20home%20page; ga_page_cookie=main%20home%20page-en; tiSessionID=017d83a03995001da44687958ee601077001606f0093c; userType=Anonymous; utag_main=v_id:017d83a03995001da44687958ee601077001606f0093c$_sn:1$_ss:1$_pn:1%3Bexp-session$_st:1638592684486$ses_id:1638590855573%3Bexp-session$free_trial:false; _abck=D1D16B71B5A0041E11F347A3E7027CF3~-1~YAAQe0InOwfJ8199AQAAzIyggwcjAbxxc16lu8WDyseRPjuQZ937GoPSqYeLTqYmTRcExtao6/9jNyDIc6jyA0vjZs7dOgiU5YhZW3gJ1f/iyB2DPgbOpNDLhvR3s6A0FTTIDu4O4QEYn3wh60Q6Msju81/vEz1o2GiXWrhLGgIzJDjjqGHMzApFohKkvHbt1Skf+8yFdi2xUe3vRJzv56Zno/yKq+OInz6yInyDnlPNsifWJhUe5ur0pjgVwMdcF/G4q3Wb4WyGUOAdk4Fm5zul+FpHQH8DYVuTptBabmhKKgelf6tdqYf9xxykMNVSmIcbFDxOZrUaMHblwes8y9tvcXwiJ7j8zqlzZhV/1s8LXvAXEyRUPSHDUsmvckduQC4w13hissGSbdIZaOaJBKDeXv1OY45tA6CnIJYMoIIS8pqIm+NfJ2Zs3+kQbU+t1we+aIO4C5cTuXVBBXp6UjcZjCe/iREzYE+kZX9b6bc=~-1~-1~-1; ti_bm=; ti_geo=country=CN|city=GUANGZHOU|continent=AS|tc_ip=113.88.97.226; ti_rid=24a42dd3; ABTasty=uid=pc7g0ygt0n9s2xcr&fst=1633679313663&pst=1637753857000&cst=1638590856425&ns=13&pvt=102&pvis=1&th=686831.851794.83.10.4.1.1633679318774.1636363793732.1; ABTastySession=mrasn=&sen=0&lp=https%253A%252F%252Fwww.ti.com.cn%252F; _ga=GA1.3.835908250.1638590856; _gat_ga_main_tracker=1; _gid=GA1.3.347776160.1638590856; bm_sv=252117522B1850B91EF5B7F35A757AF3~7/F9Uu3GKeTsJyZG6lwj0uFGAbmxYYYNYIlgxcbK9kT/9rdihn8gU+sp/579PaSja2ERCjYccudd+/L4CO29ZyIXdOpi5r6mlQosGMiRAeM6yhikGdDDlSOSoW1WzyhFw1sW31Uhi61+qYSLAUmL8VxQEsHQ1QZ3nRE8QWLOBx8=; ak_bmsc=9D86259D1B6D249796A94F858DBA715B~000000000000000000000000000000~YAAQe0InO4DG8199AQAAYXKggw61k15hule4iKOUo17NpGh2JAF+xhDcb+Z+H08b6Pr07KaJg+henMf/9GZMjBbtt9fAioUxGbAcOG2MwZc9PhZSjvf9z5LexBjpg1l+bqonFrIT7HCxS8FuNRxShsCjLJ7gB/fgdoq8koK7lAjVz2QMd5ZhJhQtjuzfxU+ALd48IoEuyLhRCJoyiiXd+o9x9rRQdCUnZlz0T11dT+sPGweGiCbgPb9STCUcescwMnRQCf6eSoiHj1S7EIXJlSDeHnFHNzQk7OPq5uBTK87NyYRuojleLdF4azGeZ4CAU1EsLcFqj79T38dJxXyNg4p6VYPWlcK3YGZuEsaUG87cf6UAusLAXFIp88UK5huOFgv+D6oc3sgFLiZgPDMfVQYycNS4zu+nDjYguEJNaZqffzRbwYzOBjZ6nHi/g1+KqiB8U2clViAh08hvV17SpRmHlZUqZW4=; gpn=Non-Product; ticontent=%2Fmain%20home%20page; tipage=%2Fmain%20home%20page%2Fmain%20home%20page-en; tipageshort=main%20home%20page-en; bm_mi=4D2AFAEA132031C2F9A705902BE9A588~TEOoid8tTbGHbWLqvpVFVjNd5w14eJJ9VU1GdNPEmU8Tu0MngRYJr5oAtixUeE1dcUQsLTUWXcyzHqN1qfrIKpAIb8bZUqnY3bDpZdSRFmlRR8WnBO+zmrJpeXtRZGFPbM+O/AqeCB82kZpkfwsIPPgkFqA/lHuCLsGz2KkSy/m6hPVkc3DtFxxcnaX9DkaNsOJEgOq1G9a4nwgMgd5rDxUnXkvWsBKiIjsw4z+J8krQgeySJ1acy9yR8vNSv1qdUP6IXrVn/36zRtw9s3ueNQ==; bm_sz=7AA0EB61F91B69AFD9C04FA465AC187E~YAAQe0InO6bC8199AQAAjkaggw4Ugz3wcnWwXQoav69FOe+1oEuQzcl5G14ML04yW1Fm90i1OJfG8etxbCOtJAtuuA7fzRRHsjNTrTsWVWC9qVdXCmAKQXWgpYC7TB2kQnaVzs+vjzD1SL62vcaKvxq3UpEuZNIqF6EGpz0IGVUnE4JHNVm0BkEuxi9/43T19HuH0vhT5xNbJPLYbOF9zinLRNppU5YR8+h+98ztxzvBWlqlcHxx38Rw5hjXusV11qxgw/lpT3oDUEWT7qfUDf4x2r6xBPliKCPLAlPnlCpdsEhIFTcsJC1eEKzsb9gXE+vyPRECkl9CcbImZ31pgyn5bMSLRR0PQbpNnZi9V5p+J1Qf3ce0mScn4Dbb3jwnEKxmX3DUkcd7AC/R42HwCfbN~3487792~4470342; ti_ua=Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010_14_6)%20AppleWebKit%2f605.1.15%20(KHTML,%20like%20Gecko)%20Version%2f14.1.2%20Safari%2f605.1.15; user_pref_currency="CNY"; user_pref_language="en-US"; user_pref_shipTo="CN"; last-domain=www.ti.com.cn; ELOQUA=GUID=68C7D27FE40344619BAD878A2EEB7031'];

	let index = randBetween(0, 2);

	let cookie = cookie_arr[index];

	let res = '';
	var headers_tmp = '';
	try{

		 var {headers} = await got(
            url,
            {
                headers: {
                    "cookie": cookie
                },
                agent: {
                    http: agent,
                    https: agent
                }
            }
        );
		 headers_tmp = headers;
        
	}catch(e){
	}	

	logger(url+headers_tmp['set-cookie'])

	return headers_tmp['set-cookie'];
}

exports.httpProxyGet4 = httpProxyGet4;	

const httpGet = (url, sessionId) => {
	return new Promise((resolve, reject) => {
		superagent.get(url).timeout(40000)
			.set('user-agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36')
			//.set('cookie', 'session-id='+sessionId)
			.set('cookie', 'turnitin_region_selection=dismissed; _gcl_au=1.1.1241897834.1639563865; _ga=GA1.2.1090852546.1639563865; _ym_uid=1639563867700281325; _ym_d=1639563867; loginIntent=TRUE; test_cookie=1; xhfaculty=0; NPS_8984eeea_last_seen=1639563921031; __utmc=162339897; __utmz=162339897.1639563923.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); lang=zh_hans; fileDownload=true; _gid=GA1.2.247682694.1640759509; XSRF-TOKEN=eyJpdiI6IjN1cTl6clhONjRCS2FvNUJpXC93ZzZBPT0iLCJ2YWx1ZSI6IjJ4NUpzZVYrV29MYU9sK05WRDU1b0oyK3ZhUUdlUFhpenVKcDR5Rnd4bElleXFlY2NvTmhaSWlPd0tHY2Y0M0xEQkE2SDZJUGdsZ3Z6M0dQZWVyWHdRPT0iLCJtYWMiOiJiNTZhYmEzOTIxMDkxNTI0MDM3ZjJmZGUyOTEzMTIwYjNjZmNlZmZjMDk5ZWIyMmEzN2E3Yzc4NGU0OTQxMTMxIn0%3D; laravel_session=eyJpdiI6IjgrVTZ1M3dqNjZuWnQ2c0NyVEd2Y2c9PSIsInZhbHVlIjoiK2VqdWxBUHNyUHB3YW9vYU9JaEhGTmR2ZXhEWGNIRmZpdSsyR3RCV0ZOVFwvbkREeXBVbGI1XC9tXC9Yd2xRVE5lQVljc3N4NnBZM1ZxQ0NqZDNlTDFpMlE9PSIsIm1hYyI6ImNkYzQwMTRjMDMzMWNlYzNlZTFjZjQ5MjJjNmQ3NDIxY2E4YmFkMDQ3ZmNlNWIzZDMzYjE3ZmE4YjJjZWI3NDkifQ%3D%3D; _clck=1drinok|1|exo|0; OptanonConsent=isGpcEnabled=0&datestamp=Wed+Dec+29+2021+17%3A35%3A35+GMT%2B0800+(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)&version=6.24.0&isIABGlobal=false&hosts=&consentId=942b9654-9188-4d1a-8255-590739509c4b&interactionCount=1&landingPath=NotLandingPage&groups=C0001%3A1%2CC0004%3A1%2CC0003%3A1%2CC0002%3A1&AwaitingReconsent=false; _uetsid=01f7ece0687111ec9b7535b759c1abab; _uetvid=2d4d83505d9111ecaf74a572fc1e90ee; _ym_isad=2; _clsk=1bj0mea|1640770941418|2|1|f.clarity.ms/collect; session-id='+sessionId+'; legacy-session-id='+sessionId+'; t=58506b1138c64567bf611679090f329c; __utma=162339897.1090852546.1639563865.1640273163.1640773099.4; __utmt=1; NPS_8984eeea_throttle=1640816299156; __utmb=162339897.5.10.1640773099')
			.end((err, res) => {
				if (err) {
					return reject(err);
				}
				resolve(res.text);
			});
	});
}

const httpPost = (url, data, contentType = null, proxy) => {
	return new Promise((resolve, reject) => {
		superagent.post(url).timeout(25000)
			.set('user-agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36')
			.set('content-type',contentType)
			.send(data)
			.end((err, res) => {
				if (err) {
					return reject(err);
				}
				resolve(res.text);
			});
	});
}
exports.httpPost = httpPost;

exports.httpGet = httpGet;

exports.sleep = sleep;

exports.logger = logger;


// 对Date的扩展，将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符，
// 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// 例子：
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18
Date.prototype.Format = function (fmt) { //author: meizz
	var o = {
		"M+": this.getMonth() + 1,                 //月份
		"d+": this.getDate(),                    //日
		"h+": this.getHours(),                   //小时
		"m+": this.getMinutes(),                 //分
		"s+": this.getSeconds(),                 //秒
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度
		"S": this.getMilliseconds()             //毫秒
	};
	if (/(y+)/.test(fmt))
		fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for (var k in o)
		if (new RegExp("(" + k + ")").test(fmt))
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	return fmt;
}

